package bch.rocketmq.graceful;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor;
import org.springframework.stereotype.Component;


@Component
public class SpringShutdownHook implements DestructionAwareBeanPostProcessor {
    private static final Logger log = LoggerFactory.getLogger(SpringShutdownHook.class);

    @Override
    public void postProcessBeforeDestruction(Object bean, String beanName) throws BeansException {
        if (beanName.equals("a")) {
            log.info("Bean {} is about to be destroyed", beanName);
        }
    }
}
